<?php /*a:2:{s:67:"D:\laragon\www\ssbeautiful\application\manage\view\login_index.html";i:1590388799;s:60:"D:\laragon\www\ssbeautiful\application\manage\view\base.html";i:1596192950;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<style>
    html, body { background: #F5F5F5;}
</style>
<div class="g-login">
    <form class="m-login">
        <h2><?php echo htmlentities($site_info['site_name']); ?></h2>
        <ul>
            <li>
                <label for="username">用户名</label>
                <input type="text" name="username" id="username" class="u-ipt" placeholder="请输入用户名" />
            </li>
            <li>
                <label for="password">密码</label>
                <input type="password" name="password" id="password" class="u-ipt u-pwd" placeholder="请输入密码" />
            </li>
            <li>
                <input type="text" name="code" class="u-ipt u-ipt-code" placeholder="请输入验证码" />
                <img src="<?php echo captcha_src(); ?>" alt="captcha" class="u-captcha" onclick="this.src='<?php echo captcha_src(); ?>'" />
            </li>
            <li><button id="j_login" class="u-btn">登录</button></li>
        </ul>
        <p>&copy; 2017-2018</p>
    </form>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script>
    $(function(){
        layui.use('layer', function(){
            $('#j_login').on('click', function(){
            	addDisabled('#j_login');
                    $user       = $('input[name="username"]'),

                    $pass       = $('input[name="password"]'),

                    $code       = $('input[name="code"]');

                

                if ($user.val() == '' || $pass.val() == '' || $code.val() == '') {

                    dialog.error('请输入用户名、密码、验证码');

                    removeDisabled('#j_login');

                    return false;
                }
                
                var index = layer.load(1, {
                    shade: [.6, '#000']
                });
                
                username = aesEncrypt($user.val());

                password = aesEncrypt($pass.val());

                code     = aesEncrypt($code.val());
                
                $.ajax({
                    url: '<?php echo url("login"); ?>',
                    type: 'POST',
                    data: {username: username, password: password, code: code},
                    dataType: 'json',
                    success: function(ret){
                        layer.close(index);
                        if (ret.status == 0) {

                            top.location.href = '<?php echo url("manage/Index/index"); ?>';

                        } else {
                            dialog.error(ret.message);
                            $('.u-captcha').attr('src', '<?php echo captcha_src(); ?>');
                        }

                        removeDisabled('#j_login');

                    },
                    error: function(){
                        layer.close(index);
                        dialog.error('服务器错误，请稍后重试！');

                        removeDisabled('#j_login');

                    }
                });
                return false;
            });
            
            $('input').keyup(function(event){
                if (event.keyCode == 13) {
                    $('input').blur();
                }
            })
        });
    })
</script>

</body>
</html>